﻿using Acme.BookStore2.Controllers;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Identity;

namespace Volo.Abp.AuditLogging
{
    /// <summary>
    /// 审计日志
    /// </summary>
    [RemoteService(Name = IdentityRemoteServiceConsts.RemoteServiceName)]
    [Area("audit-logging")]
    [ControllerName("AuditLogging")]
    [Route("api/audit-logging/audit-logs")]
    public class AuditLoggingController : BookStore2Controller, IAuditLogAppService
    {
        private readonly IAuditLogAppService _auditLogAppService;

        public AuditLoggingController(IAuditLogAppService auditLogAppService)
        {
            _auditLogAppService = auditLogAppService;
        }

        /// <summary>
        /// 获取列表（分页）
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<PagedResultDto<AuditLogDto>> GetListAsync(GetAuditLogsInput input)
        {
            return await _auditLogAppService.GetListAsync(input);
        }

        /// <summary>
        /// 获取详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("{id}")]
        public async Task<AuditLogDto> GetAsync(Guid id)
        {
            return await _auditLogAppService.GetAsync(id);
        }
    }
}
